<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>登录页面</title>
</head>
<body>

<form action="login" method="post">
    用户名:<input type="text" name="username"/><br>
    密码:<input type="text" name="password"/><br>
    验证码: <input type="text" name="mycode"/><img src="mycode" onclick="changeCode(this);" alt="这是一个验证码"><br>
    <input type="submit" value="登录"/><br>
</form>

</body>
<script>
    /**
     * 更换验证码
     * @param obj
     */
    function changeCode(obj) {
        obj.src = "mycode?time="+new Date().getTime();
    }
</script>

</html>